import 'package:casdon/core/logger/log.dart';
import 'package:casdon/core/network/business_exception.dart';
import 'package:casdon/modules/me/data/api/service_product_list_api.dart';
import 'package:casdon/modules/me/data/repository/me_repository.dart';
import 'package:casdon/modules/me/data/repository/me_repository_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class SocialDelBindUsecase {
  final MeRepository _repository;

  const SocialDelBindUsecase(this._repository);

  Future<bool> execute(String sociaId) async {
    try {
      await _repository.delSocialBind(sociaId);
      return true;
    } on BusinessException {
      rethrow;
    } catch (e) {
      Log.e("SocialDelBindUsecase 失败", e.toString(), StackTrace.current);
      return false;
    }
  }
}

final socialDelBindUsecaseProvider = Provider(
  (ref) => SocialDelBindUsecase(ref.read(meRepositoryProvider)),
);
